<div ng-include="'/modules/template/header.html'"></div>  
<div class="weizhi">
	<div class="container">
    	<div class="row">
        	<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 t_weizhi">
            	当前位置->><a href="">首页</a>->><a href="" ng-bind="title"></a>
            </div>
        </div>
    </div>
</div>

<div class="t_main tt_main">
	<div class="container">
    	<div class="row">
			<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding: 0;">
				<div ng-include="'/modules/template/member_center_menu.html'"></div>  
				<div class="col-lg-9 col-md-9 col-sm-12 col-xs-12 wx_form_box">
					<div class="wxbox">
                    	<div class="wx_tabel_titel">
							<a class="wx_title">收货地址</a>
                            <div class="clear"></div>
                        </div>
                        <div class="wx_add_title"><span>新增收货地址</span>&nbsp;&nbsp;所有内容均为必填项</div>
                        <div>
	                         <form class="form-horizontal" id="myForm" role="form" name="myForm">
			                        <div class="wx_add_region">
			                        <input ng-model="consigneeInfo.id" ng-hide="true" >
			                        	<div class="wx_add_region_title"><span >*</span>&nbsp;&nbsp;所在地区：</div>
			                        	<div class="btn-group">
			                        	<!-- <input type="text" class="wx_add_shuru" placeholder="请选择地区" id="txt_city"  readonly="readonly"> -->
			                        	<input id="sel1"  type="text"  class="wx_add_shuru"  readonly="readonly"  placeholder="请选择地区" style="width:250px; position:relative; " value="">
			                            </div>
			                         </div>
			                         <div class="wx_add_region">
			                            <div class="clear"></div>
			                            <div class="wx_add_region_title"><span >*</span>&nbsp;&nbsp;详情地址：</div>
			                            <input type="text" class="wx_add_shuru" name="address" ng-maxlength="30" ng-required="true" placeholder="建议您如实填写详细地址，例如街道名称，门牌号码，楼层和房间号等信息" ng-model="consigneeInfo.connect_address">
			                             <div class="clear"></div>
			                         </div>
			                             <div  style="width:55%;text-align:center;margin:1 auto" ng-show="myForm.address.$dirty && myForm.address.$error.maxlength" class="alert alert-danger help-block">
														地址不能超过30个字符 
											</div>
			                         <div class="wx_add_region">
			                             <div class="wx_add_region_title"><span>*</span>&nbsp;&nbsp;邮政编码：</div>
			                             <input type="text" class="wx_add_code" ng-maxlength="6"name="code" ng-pattern="/^[0-9]/" placeholder="如若不清楚，请填写‘000000’" ng-required="true" ng-model="consigneeInfo.postcode">
			                             <div class="clear"></div>
			                         </div>
			                             <div  style="width:55%;text-align:center;margin:1 auto"ng-show="myForm.code.$dirty && myForm.code.$error.maxlength" class="alert alert-danger help-block">
														邮政编码不能超过6个字符 
										</div>
										<div  style="width:55%;text-align:center;margin:1 auto" ng-show="myForm.code.$dirty && myForm.code.$error.pattern" class="alert alert-danger help-block">
													邮政编码不能是汉字 
										</div>
										
			                          <div class="wx_add_name">
			                             <div class="wx_add_region_title"><span>*</span>&nbsp;&nbsp;收货人姓名：</div>
			                             <input type="text" class="wx_add_code"ng-maxlength="8"  name="consigneeName" ng-required="true" placeholder="请填写真实姓名" ng-model="consigneeInfo.consignee_name">
			                             <div class="clear"></div>
			                           </div>
			                             <div  style="width:55%;text-align:center;margin:1 auto" ng-show="myForm.consigneeName.$dirty && myForm.consigneeName.$error.maxlength" class="alert alert-danger help-block">
														收货人姓名不能超过8个字符 
										 </div>
										 
			                           <div class="wx_add_num">
			                             <div class="wx_add_region_title"><span>*</span>&nbsp;&nbsp;手机号：</div>
			                             <input type="text" class="wx_add_code" ng-maxlength="11" name="phone" ng-pattern="/^1[34578]\d{9}$/" ng-required="true" placeholder="请填写真实有效的手机号" ng-model="consigneeInfo.telephone">
			                             
			                             <div class="clear"></div>
			                           </div>
			                             <div  style="width:55%;text-align:center;margin:1 auto"ng-show="myForm.phone.$dirty && myForm.phone.$error.maxlength" class="alert alert-danger help-block">
														手机号不能超过11个字符
										 </div>
										 <div  style="width:55%;text-align:center;margin:1 auto"ng-show="myForm.phone.$dirty && myForm.phone.$error.pattern" class="alert alert-danger help-block">
													请输入有效的手机号码
										 </div>
			                           <div class="wx_add_set"> 
			                             <input type="checkbox"  id="checkbox_c" checked />
			                             <label for="checkbox_c" ></label>
			                             设为默认收货地址
			                            </div>
			                            <div class="clear"></div>
			                            <button type="button" class="wx_add_btn" ng-click="saveAddress()" ng-disabled="myForm.$invalid">保存</button>
	                            </form>
                            </div>
		<div class="wx_address_title" >已保存了{{consigneeList.length}}条收货地址，还能保存{{5-consigneeList.length}}条地址</div>
				<div class="address_list" ng-repeat="c in consigneeList">
					<ul >
				    	<li>
				        	<div class="address_list_top" ><span ng-bind="c.consignee_name"></span><span ng-bind="c.telephone"></span></div>
				        	<div class="address_list_main" >{{c.province+c.city+c.connect_address}}</div>
				        	<div class="address_list_bottom">
				            	<div class="address_list_bottom_left" ng-class="{moren:c.is_default}" ng-click="isDefault(c.id)">{{c.is_default ? '默认地址' : '设为默认地址'}}</div>
				            	<div class="address_list_bottom_right">
				                	<a href="" ng-click="editAddress(c.id)"><img src="/temp/images/bianji.png">编辑</a>
				                	<a href="" ng-click="delAddress(c.id)"><img src="/temp/images/delete.png" >删除</a>
				                </div>
				                <div class="clear"></div>
				            </div>
				        </li>
				    </ul>
					<div class="clearfix"></div>
				</div>
				</div>
			</div>
        </div>
    </div>
</div>
</div>
<script>
	$(function(){
		init_city_select($("#sel1, #sel2"));
	});
	
	function getValue() {
		alert($('#sel1').val());
	}
</script>
